# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Josip Ponjavic <josipponjavic at gmail dot com>
# Contributor: Xu Fasheng <fasheng.xu[AT]gmail.com>

pkgname=deepin-system-monitor
pkgver=6.0.3
pkgrel=3
pkgdesc='A more user-friendly system monitor'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-system-monitor"
license=('GPL3')
depends=('deepin-qt5integration' 'deepin-dock' 'dtkwm' 'dwayland' 'procps-ng' 'libcap')
makedepends=('cmake' 'deepin-gettext-tools' 'gtest' 'ninja' 'qt5-tools')
groups=('deepin')
install=deepin-system-monitor.install
source=("$pkgname-$pkgver.tar.gz::https://github.com/linuxdeepin/deepin-system-monitor/archive/$pkgver.tar.gz"
        $pkgname-missing-symbol.patch::https://github.com/linuxdeepin/deepin-system-monitor/pull/205.patch
        a159e571.patch)
sha512sums=('189c3283bb3fa88dccb2d3ce6aa542954c196a14d58a638de03f8f9c08573f697844ae4c1343f3034ac351c57ac5026c0bc0c9812c05bd8af346c994e3dbb8b0'
            'de9e8192eeeed71cf897190b2ebdfbbd0b46b481ecc2d5cf679f85eb2417c45ff0d49598da69b08760da77abf8cabcf15c424da263e4a77f07e9963e6f431b96'
            'cf0d2dd71fda8bc076531535d3460a8b1114eff5294394ccf03d2813fa02fe046604040add04c9639b68e99fe6056e1fba03b451b06d615a1def6ff3cac24ad0')

prepare() {
  mkdir -p build
  patch -d deepin-system-monitor-$pkgver -p1 < $pkgname-missing-symbol.patch
  patch -d $pkgname-$pkgver -p1 < a159e571.patch # Fix missing includes
}

build() {
  cd build
  cmake ../deepin-system-monitor-$pkgver -GNinja -DCMAKE_INSTALL_PREFIX=/usr
  ninja
}

package() {
  cd build
  DESTDIR="$pkgdir" ninja install
}
